﻿using System;
using Vowei.Core.Models;
using Vowei.Data;
using Vowei.Data.Models;
using System.Web;
using Autofac;
using Vowei.Data.Helpers;

namespace Vowei.Web.Helpers
{
    public static class CommentHelpers
    {
        public static Comment MakeComment<T>(T ticket, string commentText)
            where T : ICommentable, ITable
        {
            var comment = new Comment()
            {
                PostId = ticket.ID,
                PostType = EntityHelpers.GetEntityTypeName(ticket.GetType()),
                Text = commentText,
                CommentDate = DateTime.Now,
                User = ViewHelpers.GetLogonUserName()
            };

            return comment;
        }
    }
}